import java.util.Scanner;
public class Test5 {
    public static void main(String[] args) {
     int []newArr=getScore();
     int max=getMax(newArr);
     int min=getMin(newArr);
     int sum=getSum(newArr);
       int df= (sum-max-min)/4;
       System.out.println(df);
    }
    public static int[] getScore() {
        int []arr=new int[6];
        Scanner sc=new Scanner(System.in);
        for(int i=0;i<6;) {
           int score=sc.nextInt();
            if(score>=0 && score<=100) {
                arr[i]=score;
                i++;
            }
            else{
                System.out.println("输入成绩错误");
            }

        }
        return arr;
    }
    public static int getMax(int[] arr) {
        int max=arr[0];
        for (int i = 0; i < arr.length; i++) {
            if(max<arr[i]) {
                max=arr[i];
            }
        }
        return max;
    }
    public static int getMin(int[] arr) {
        int min=arr[0];
        for (int i = 0; i < arr.length; i++) {
            if(min>arr[i]) {
                min=arr[i];
            }
        }
        return min;
    }
    public static int getSum(int[] arr) {
        int sum=0;
        for (int i = 0; i < arr.length; i++) {
            sum+=arr[i];
        }
        return sum;
    }
}
